<?php
    $this->title = $title;
?>

<style type="text/css">
	.hide {
		display: none;
	}
	.weui_dialog {
		width:  50%;
	}
</style>
<div class="container">
    <div class="weui_panel weui_panel_access">
        <div class="weui_panel_hd">订单详情</div>
        <div class="weui_panel_bd">
        	<?php foreach($order_list as $k => $order): ?>
                <div class="weui_media_box weui_media_text">
                    <h4 class="weui_media_title">订单<?=$k+1?></h4>
                    <p class="weui_media_desc">
                    	<p>订单用户: <?=$order->username?></p>
                    	<p>订单内容: VIP会员*<?=$order->count?>个月</p>
                    	<p>订单金额: <?=$order->count * 10?>元</p>
                    	<p>订单时间: <?=date("Y-m-d H:i:s", $order->create_at)?></p>
		<p>支付状态: <?=$order->pay_at ? '已支付' : '未支付'?></p>
                    </p>
                </div>
            <?php endforeach; ?>
        </div>
    </div>

    <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>

    <div class="weui_tabbar" style="position: fixed; margin-top: 60px">
        <a class="weui_tabbar_item" href="/user">
            <div class="weui_tabbar_icon">
                <img alt="" src="../images/icon_nav_cell.png">
            </div>
            <p class="weui_tabbar_label">个人中心</p>
        </a>
        <a class="weui_tabbar_item weui_bar_item_on" href="/qrcode">
            <div class="weui_tabbar_icon">
                <img alt="" src="../images/icon_nav_msg.png">
            </div>
            <p class="weui_tabbar_label">发布二维码</p>
        </a>
        <a class="weui_tabbar_item" href="/orders/">
            <div class="weui_tabbar_icon">
                <img alt="" src="../images/icon_nav_button.png">
            </div>
            <p class="weui_tabbar_label">购买VIP</p>
        </a>
    </div>
</div>

    <script type="text/javascript" src="//cdn.bootcss.com/jquery/3.1.0/jquery.min.js"></script>
    <script type="text/javascript">
    	// 加载更多
    	var person_page = group_page = 1;
    	$('#load_more').click(function () {
    	    var page = 1;
    	    var type = 2;
    	    if($('.weui_navbar .weui_navbar_item:first').hasClass('weui_bar_item_on')) {
    	        type = 1;
    	        person_page ++;
    	        page = person_page;
    	    }else{
    	        group_page ++;
    	        page = group_page;
    	    }

    	    console.log(type, page)
    	    $.get(
    	    	'/qrcode/ajaxlist?page='+page+'&type='+type,
    	    	function(res) {
    	    	    var data = eval('('+res+')');
    	    	    var node = '';
    	    	    $.each(data, function(index, val) {
    	    	    	node += '<a class="weui_media_box weui_media_appmsg" href="javascript:void(0);" data-qrcode="'+val.qrcode+'"><div class="weui_media_hd"><img alt="" src="'+val.avatar+'" class="weui_media_appmsg_thumb"></div><div class="weui_media_bd"><h4 class="weui_media_title">'+val.username+'</h4><p class="weui_media_desc">'+val.description+'</p></div></a>';
    	    	    });

    	    	    // console.log(node);
    	    	    $('.weui_panel_bd').each(function(index, el) {
    	    	    	if(index+1 == type) {
    	    	    	    console.log(el)
    	    	    	    $(el).append(node)
    	    	    	}
    	    	    });
    	    	});
    	})
    </script>